package cn.xgj.sfzy.service.impl;

import cn.xgj.sfzy.mapper.AccountMapper;
import cn.xgj.sfzy.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassName AccountServiceImpl
 * @Description TODO
 * @Author xgj
 * @Date 2024年10月31日 上午11:33
 * @Version 1.0
 */
@Service
@Transactional(timeout = 10,isolation = Isolation.DEFAULT,noRollbackFor = NullPointerException.class)
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountMapper accountMapper;

    @Override
    public void zz(String fusername, String tusername, Double money) {
        //  1.转出
        accountMapper.update(fusername,-money);
//        System.out.println(1/0);

//        String a = null;
//        System.out.println(a.toString());
        //  2.转入
        accountMapper.update(tusername,money);
    }
}
